import { PaginationParam, PaginationResult } from "../../models";
import { EquipmentCategoryItem, ParEquipmentCategoryItem } from "./models";
import req, { RequsetOptons } from "/@/api/req";
export enum Api {
  pageEquipmentCategory = "api/aiot/equipmentCategory/pageEquipmentCategory",
  saveOrUpdateEquipmentCategory = "api/aiot/equipmentCategory/saveOrUpdateEquipmentCategory",
  deleteEquipmentCategoryByIds = "api/aiot/equipmentCategory/deleteEquipmentCategoryByIds",
  copyDefaultEquipmentCategory = "api/aiot/equipmentCategory/copyDefaultEquipmentCategory",
}
export enum ApiSystem {
  pageEquipmentCategory = "api/aiot/defaultEquipmentCategory/pageEquipmentCategory",
  saveOrUpdateEquipmentCategory = "api/aiot/defaultEquipmentCategory/saveOrUpdateEquipmentCategory",
  deleteEquipmentCategoryByIds = "api/aiot/defaultEquipmentCategory/deleteEquipmentCategoryByIds",
}

// 获取设备分组查询数据
export function saveOrUpdateEquipmentCategory(data: ParEquipmentCategoryItem) {
  return req.post<boolean>(
    {
      url: Api.saveOrUpdateEquipmentCategory,
      data,
    },
    {
      useGlobalLoading: false,
    }
  );
}
// 获取设备分组查询数据
export function saveOrUpdateEquipmentCategorySys(data: ParEquipmentCategoryItem) {
  return req.post<boolean>(
    {
      url: ApiSystem.saveOrUpdateEquipmentCategory,
      data,
    },
    {
      useGlobalLoading: false,
    }
  );
}

export function pageEquipmentCategory(model?: ParEquipmentCategoryItem) {
  return req.commonPost<PaginationResult<EquipmentCategoryItem>>(Api.pageEquipmentCategory, {
    size: 999,
    current: 1,
    model: { parentCategoryId: 0, ...model },
  });
}
export function pageEquipmentCategorySystem(model?: ParEquipmentCategoryItem) {
  return req.commonPost<PaginationResult<EquipmentCategoryItem>>(ApiSystem.pageEquipmentCategory, {
    size: 999,
    current: 1,
    model: { parentCategoryId: 0, ...model },
  });
}
export function copyDefaultEquipmentCategory(data: PaginationParam<{ searchText?: string }>) {
  return req.commonPost<boolean>(Api.copyDefaultEquipmentCategory, data);
}
